package com.fbinggun.fbinggunutil.command.args;


import com.fbinggun.fbinggunutil.command.ACommand;
import com.fbinggun.fbinggunutil.command.MainCommand;
import org.bukkit.command.CommandSender;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * 重载插件指令
 */
public class reload extends ACommand {
    public reload(MainCommand mainCommand) {
        super(mainCommand);
    }

    @Override
    public String getPresentation() {
        return "&f/"+getMainCommand().getCmd()+" "+getId()+" &a重载成功配置文件";
    }

    @Override
    public boolean isOp() {
        return true;
    }

    @Override
    public String getPermission() {
        return null;
    }

    @Override
    public String getId() {
        return "reload";
    }

    @Override
    public boolean run(CommandSender sender, String[] args) {
        getPlugin().reload();
        sender.sendMessage("插件重载成功");
        return false;
    }

    @Override
    public boolean isPlayer() {
        return false;
    }
    @Override
    public List<String> getTAB(int l,CommandSender sender) {
        List<String> list = new ArrayList<>();
        if(l==1){
            list.add(getId());
        }

        return list;
    }
}
